<?php
class ContactForm extends Zend_Form {
	public function __construct($options = null) {
		parent::__construct($options);
		$id = $this->createElement('hidden','id');
		$name = $this->createElement('text','name')->setLabel('Name')->setAttrib('size',50)->setRequired(true)->addValidator('NotEmpty')->addErrorMessage('Please enter a name.');
		$email = $this->createElement('text','email')->setLabel('Email')->setAttrib('size',50)->setRequired(true)->addValidator('NotEmpty', true)->addValidator('EmailAddress')->addErrorMessage('Please enter a valid email address (email@domain.com).');
		$message = $this->createElement('textarea','message')->setLabel('Message')->setAttrib('rows',4)->setAttrib('cols',20);
		$send = $this->createElement('button','send')->setLabel("Send")->setAttrib('type','button')->setAttrib('value','send')->setAttrib('onclick','sendMessage()')->setIgnore(true);
		$this->addElements(array($name,$email,$message,$send));
		$this->clearDecorators();
		$this->setDecorators(array('FormElements','Form'));
		$this->setElementDecorators(array(
			array('ViewHelper'),
			array('Errors'),
			array('Label'),
			array('HtmlTag',array('tag'=>'div','class'=>'row')),
		));
		$send->setDecorators(array(array('ViewHelper'),array('HtmlTag',array('tag'=>'div','class'=>'row'))));
		$this->setElementFilters(array('HtmlEntities'));
	}
}